package org.artifact.core.context.session;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public abstract class AbstractSession implements Session,SessionAttrMap{
    protected Map<SessionAttrKey<?>, SessionAttr<?>> attrs = new ConcurrentHashMap<>();

    @Override
    public <T> SessionAttr<T> attr(SessionAttrKey<T> key) {
        return (SessionAttr<T>) attrs.computeIfAbsent(key, k -> new SessionAttr<>());
    }
}
